package com.auhaix.common;

/**
 * Author: Auhaix
 * E-mail: xh@qiandw.com
 * Description:返回对象工具类
 * CreatedTime: 2017/8/2 16:41
 * Modified by:
 */
public class ResponseUtils {
    public static Response success(ResponseEnum responseEnum, Object data) {
        Response response = new Response();
        response.setMsgCode(responseEnum.getMsgCode());
        response.setMsg(responseEnum.getMsg());
        response.setData(data);
        return response;
    }

    public static Response success() {
        return success(ResponseEnum.SUCCESS, null);
    }

    public static Response error(ResponseEnum responseEnum) {
        Response response = new Response();
        response.setMsgCode(responseEnum.getMsgCode());
        response.setMsg(responseEnum.getMsg());
        return response;
    }

    public static Response error(String msgCode, String msg) {
        Response response = new Response();
        response.setMsgCode(msgCode);
        response.setMsg(msg);
        return response;
    }
}
